package 牛客网_N.动态规划.最近公共祖先_1;

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String str = in.nextLine();
		int a = Integer.parseInt(str.split(",")[0]);
		int b = Integer.parseInt(str.split(",")[1]);
		while(a != b){
			if(a > b){
				a = a/2;
			}else{
				b = b/2;
			}
		}
		System.out.println(a);
	}
}
